using EnvDTE;

namespace Core
{
	public class OutputPane
	{
		private OutputWindowPane _windowPane;

        public OutputPane(OutputWindowPane windowPane)
        {
            _windowPane = windowPane;
        }

		public void RegisterWindow(OutputWindowPane outputPane)
		{
			_windowPane = outputPane;
		}

		public void PrintMessage(string message, bool cr = true)
		{
			if (_windowPane == null)
				return;

			_windowPane.OutputString(message + (cr ? "\n" : ""));
		}

		public void Clear()
		{
			_windowPane.Clear();
		}

        public void JumpToBottom()
        {
            _windowPane.Activate();
            _windowPane.TextDocument.Selection.EndOfDocument();
        }
        
        public void JumpToTop()
		{
			_windowPane.Activate();
			_windowPane.TextDocument.Selection.GotoLine(1);
		}
	}
}